package org.ant.MyCalculate;

import android.widget.TextView;

public class OperationTool {
	private Double firstNumber;
	private Double secondNumber;
	private String operation;
	private TextView textView;
	
	OperationTool (Double firstNum ,Double secondNum ,String operation ,TextView textView) {
		this.firstNumber = firstNum;
		this.secondNumber = secondNum;
		this.operation = operation;
		this.textView = textView;
	}
	
	Double dealOperation(){
		Double result;
		if(operation.equals("+")){
			result = (firstNumber + secondNumber);
			textView.setText(result.toString());
		}else if(operation.equals("-")){
			result = (firstNumber - secondNumber);
			textView.setText(result.toString());
		}else if(operation.equals("*")){
			result = (firstNumber * secondNumber);
			textView.setText(result.toString());
		}else if(operation.equals("/")){
			result = (firstNumber / secondNumber);
			textView.setText(result.toString());
		}else{
			result = 0.0;
			textView.setText(result.toString());
		}
		return result;
	}
}
